package com.itheima.controller;

import com.itheima.domain.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@RequestMapping("/user")
@Controller
@ResponseBody
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping(value="/findAll.do")
    public List<User> findAll() {
        return userService.findAll();
    }
    @RequestMapping(value="/findById.do")
    public User findById(Integer id) {
        return userService.findById(id);
    }
    @RequestMapping(value="/update.do")
    public void update(@RequestBody User user) {
         userService.update(user);
    }

}
